package com.nf.health.app.utils;

import android.content.Context;

/**
 * Created by 恩福 on 2016/11/1.
 * 剪切板操作
 * @auther changpeng
 * @email obj_cp@126.com
 */

public class ClipboardUtils {
    //复制内容到剪切板
    @SuppressWarnings("deprecation")
    public static void copyToClipboard(Context context, String text){
        android.text.ClipboardManager cbm = (android.text.ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
        cbm.setText(text);

    }
    //得到剪切板的内容
    @SuppressWarnings("deprecation")
    public static CharSequence getClipboardText(Context context){
        android.text.ClipboardManager cbm = (android.text.ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
        return cbm.getText();
    }
}
